import matplotlib.pyplot as plt


def Bresenham(x0, y0, x1, y1):
    dx = abs(x1 - x0)/1000
    dy = abs(y1 - y0)/1000
    if x0 < x1:
        sx = 1
    else:
        sx = -1

    if y0 < y1:
        sy = 1
    else:
        sy = -1

    if dx > dy:
        err = dx/2
    else:
        err = -dy/2

    while 1:
        plt.scatter(x0, y0, s=10)
        if x0 == x1 and y0 == y1:
            break
        e2 = err
        if e2 > -dx:
            err -= dy
            x0 += sx
        if e2 < dy:
            err += dx
            y0 += sy

    # x = list(range(1, 1001))
    # y = [x**2 for x in x]
    # plt.scatter(x, y, s=10)
    # #设置标题并加上轴标签
    # plt.title("Squares Numbers", fontsize=24)
    # plt.xlabel("Value", fontsize=14)
    # plt.xlabel("Square of Value", fontsize=14)
    #
    # #设置刻度标记的大小
    # plt.tick_params(axis='both', which='major', labelsize=14)
    #
    # #设置每个坐标的取值范围
    # plt.axis([0, 1100, 0, 1100000])
    plt.show()


if __name__ == "__main__":
    x0 = int(input("请输入x0"))
    y0 = int(input("请输入y0"))
    x1 = int(input("请输入x1"))
    y1 = int(input("请输入y1"))
    Bresenham(x0, y0, x1, y1)